"use strict";
exports.__esModule = true;
var DateFormat = /** @class */ (function () {
    function DateFormat(nowDate) {
        if (nowDate === void 0) { nowDate = new Date(); }
        this.nowDate = nowDate;
    }
    Object.defineProperty(DateFormat, "Instance", {
        get: function () {
            return this._instance || (this._instance = new this());
        },
        enumerable: true,
        configurable: true
    });
    DateFormat.prototype.formatOrderTime = function (date) {
        var nowTime = new Date().getTime();
        date = date.substring(0, 19);
        date = date.replace(/-/g, '/');
        var time = new Date(date).getTime();
        var resTime = (time - nowTime) / 1000;
        var day = Math.floor(resTime / (24 * 60 * 60));
        var hour = Math.floor(resTime % (24 * 60 * 60) / (60 * 60));
        var minute = Math.floor(resTime % (24 * 60 * 60) % (60 * 60) / 60);
        var second = Math.floor(resTime % (24 * 60 * 60) % (60 * 60) % 60);
        var returnStr = {
            day: day,
            hour: hour,
            minute: minute,
            second: second
        };
        // let hours = time.getHours().toString().length < 2 ? "0" + time.getHours() : time.getHours();
        // let min = time.getMinutes().toString().length < 2 ? "0" + time.getMinutes() : time.getMinutes();
        // returnStr = time.getFullYear().toString() + "/" + (time.getMonth() + 1) + "/" + time.getDate() + " " + hours + ":" + min
        return returnStr;
    };
    return DateFormat;
}());
var instance = DateFormat.Instance;
exports["default"] = instance;
